#include "ControlVigverseCmd.h"

ControlVigverseCmd::ControlVigverseCmd(QObject *parent) :
    BaseCmd(parent)
{
    this->m_protocolType = ProtocolType::Version2Protocol;
    this->m_functionCode = FunctionCode;
}

Package ControlVigverseCmd::toPackage()
{








    Package package;


    QByteArray body;
    quint16 bodylength=0;



    bodylength=11;
    body.append(DataTypeConver::intToByteArray(0,2));
    body.append(DataTypeConver::intToByteArray(0,2));
    body.append(DataTypeConver::intToByteArray(0,2));
    body.append(DataTypeConver::intToByteArray(m_destinationRoomNO,2));
    body.append(m_ctlDevType);
    body.append(m_action);
     body.append(m_value);
    package.setBody(body);
    package.setFunction(ControlVigverseCmd::FunctionCode);
    package.setId(0x01);

     return package;
}

void ControlVigverseCmd::unPackage(Package package)
{
    Q_UNUSED(package);
}

void ControlVigverseCmd::setRoomNO(quint16 no)
{
    m_destinationRoomNO = no;
}

void ControlVigverseCmd::setCtlDevType(quint8 type)
{
    m_ctlDevType = type;
}

void ControlVigverseCmd::setRelay(quint8 no, quint8 action, quint8 value)
{
    m_relayNo = no;
    m_action = action;
    m_value = value;
}

void ControlVigverseCmd::setComputer(quint8 value)
{
    m_action = 0;
    m_value = value;

}
void ControlVigverseCmd::setProject(quint8 no,quint8 value)
{
    m_action = no;
    m_value = value;
}

void ControlVigverseCmd::setCurtain(quint8 no,quint8 value)
{
    m_action = no;
    m_value = value;
}

void ControlVigverseCmd::setAirCondition(quint8 action,quint8 value)
{
    m_action = action;
    m_value = value;
}

void ControlVigverseCmd::setScence(quint8 value)
{
    m_action= 0;
    m_value = value;
}

void ControlVigverseCmd::setRestart(quint8 value)
{
    m_action = 0;
    m_value = value;
}

